package com.fypg.module.medical.controller.app.map;

import com.fypg.framework.common.pojo.CommonResult;
import com.fypg.module.medical.controller.app.map.vo.*;
import com.fypg.module.medical.service.hospitalmap.HospitalMapService;
import com.fypg.module.medical.service.organizationmap.OrganizationMapService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.fypg.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 APP - 地图（医院地图 & 机构地图）")
@RestController
@RequestMapping("/api/v1/home")
@Validated
public class AppMapController {

    @Resource
    private OrganizationMapService organizationMapService;

    @Resource
    private HospitalMapService hospitalMapService;

    @GetMapping("/GetMedicalOrganizationMapList")
    @Operation(summary = "获得医疗机构地图")
    public CommonResult<AppMapRespVO<AppOrganizationMapRespVO>> getOrganizationMapList(@Valid AppOrganizationMapReqVO reqVO) {
        AppMapRespVO<AppOrganizationMapRespVO> organizationMap = organizationMapService.getOrganizationMapList(reqVO);
        return success(organizationMap);
    }

    @GetMapping("/GetMedicalHospitalMapList")
    @Operation(summary = "获取医院地图列表")
    public CommonResult<AppMapRespVO<AppHospitalMapRespVo>> getHospitalMapList(AppHospitalMapReqVo reqVO) {
        AppMapRespVO<AppHospitalMapRespVo> hospitalMapList = hospitalMapService.getHospitalMapList(reqVO);
        return success(hospitalMapList);
    }
}
